/*
 *  edb_net_utils.h
 *  edb
 *
 *  Created by Grant Jones on 3/22/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef EDB_NET_UTILS_H
#define EDB_NET_UTILS_H

#include "cmap.h"

/*!
	@function edb_net_base64string
	@abstract encodes the input string as base-64
	@discussion encodes the input string, z, as base-64 using the OpenSSL
				library
	@param pool
	@param z the string to encode
	@param n the length of the string to encode
	@result a cmap string (cmap_str_*) allocated from pool
*/
cmapStruct *edb_net_base64string( mempool_t *pool, const char *z, size_t n );

/*!
	@function edb_net_URIEncode
	@abstract encodes the input string into URI encoded form
	@discussion determines the resulting encoded length, allocates a buffer and
				places the encoded result into the buffer returning it
	@param pool
	@param z string to encode
	@param n length of the string to encode
	@result a null-terminated c-string allocated from pool
*/
char *edb_net_URIEncode( mempool_t *pool, const unsigned char *z, size_t n );

/*!
	@function edb_net_URIDecode
	@abstract decodes the input string from URI encoded form
	@discussion 
	@param pool
	@param z string to decode
	@param n length of the string to decode
	@result a null-terminated c-string allocated from pool
*/
char *edb_net_URIDecode( mempool_t *pool, const unsigned char *z, size_t n );


#endif


